package com.soyoung.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @description :  枚举
 */
public class Enums {

    public enum ResStatus{
        SUCCESS("10000","请求成功"),
        SYSTEM_ERROR("10001", "服务器错误"),
        URL_ERROR("10002", "地址不存在"),
        INVALID_REQUEST("10003", "请求失败"),
        PARAM_ERROR("10004","参数错误"),
        PARAM_NULL("10005","参数不能为空"),
        SIGN_ERROR("10006","签名验证失败"),
        DATA_FORMAT_ERROR("10007","数据格式错误"),
        FILE_FORMAT_ERROR("10008","文件格式错误"),
        FILE_UPLOAD_FAILED("10009","文件上传失败"),
        FILE_OUTOF_MAX_SIZE_ERROR("10010", "文件已超出上限"),
        excel_ERROR("10011", "无导出权限"),
        GET_INFO_ERROR("10012", "无操作权限"),
        Excel_Is_Null("10013", "Excel为空"),
        SendMsg_ERROR("10014","短信发送失败"),
        SendMsg_ECHO("10015","短信已发送,请勿重新发送"),
        Max_ERROR("10016","请删除现有图片,即可重新添加"),
        Exceed_Start_End_ERROR("10017","开始结束时间不能超过31天"),
        SEND_MSG_BACK_ERROR("10018","短信接口回调错误"),
        Excel_Field_Is_Null("10019","Excel有字段为空"),
        Bill_Is_Not_Upload("10020","分期账单今天已经上传过,不可以重复上传"),


        Update_ERROR("30001","修改失败"),
        Save_ERROR("30002","添加失败"),
        Del_ERROR("30003","删除失败"),
        ;
        ResStatus(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String code;
        private String desc;

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }
    }

    /**
     * menu type
     */
    public enum MenuType{
        PARENT("0","父菜单"),
        LEAF("1","儿子"),
        LEVEL3("2","3级菜单"),
        ;
        MenuType(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String code;
        private String desc;

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        private static final Map<String,MenuType> MAP;

        static {
            MAP = new HashMap<>();
            MenuType[] values = values();
            for (MenuType as : values){
                MAP.put(as.code,as);
            }
        }

        public static MenuType getAdminUserStatusByCode(String code){
            return MAP.get(code);
        }

    }


    public enum LoginStatus{
        ADMIN_NOT_EXIST("20001","用户不存在"),
        PASSWORD_ERROR("20002","账号或密码错误"),
        USER_INFO_ERROR("20003","用户信息有误"),
        FREEZE_USER("20004","用户被冻结"),
        NOT_ALLOW_OUTSIDE("20005","不允许外网登录"),
        LOGIN_BY_OUTSIDE("20006","外网登录"),
        VF_CODE_ERROR("20007","验证码错误"),
        ADMIN_NOT_LOGIN("20008","用户未登陆"),
        ADMIN_NOT_TREE("20009","用户无权限"),
        VF_CODE_SEND_FAIL("20010","验证码发送失败"),
        PASSWORD_ERROR_COUNT("20011","账号或密码多次错误"),//用户多次密码错误
        ;

        LoginStatus(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String code;
        private String desc;

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }
    }



}
